<?php
//$xml = new SimpleXMLElement();
//const var MOVIE = 'movie';
//$_movie = 'movie';
//--- load in xml file to edit.  if doesnt exist, create ---
//$xmlFile = "a.xml";
//$xmlHandle = fopen($xmlFile, "w+") or die("can't open file");

//--- set xml as string to be written ---


$xml = simplexml_load_file('a.xml');
$case = new SimpleXMLElement($xml->asXML());

//print_r($xml);
echo $case->getName().'<br>';
echo $case->movie[0]->title.'<br>';
echo $case->movie[0]->characters[0]->character->name.'<br>';
$a = $case->xpath('/movies/movie/time');
echo $a[0];
$b = $xml->movie->addChild('love','10:23');

$xml->asXML('a.xml');

//$b = $xml->movie->addChild('time','10:23');
//print_r($b);
//print_r($xml->getNamespaces());
//print_r($xml->getDocNamespaces());
//echo $xml->getDocNamespaces().'<br>';
//echo $xml->count().'<br>';

//--- close out xml file ---
//fclose($xmlHandle);

?>
